<template>
  <div>
    <!-- 这里将来会放置多选列表 -->
    <el-checkbox-group v-model="roleIds">
      <el-checkbox v-for="role in list" :key="role.id" :label="role.id">
        {{ role.name }}
      </el-checkbox>
    </el-checkbox-group>

    <div style="margin-top: 20px; text-align: right">
      <el-button type="primary">确定</el-button>
      <el-button @click="closeDialog">取消</el-button>
    </div>
  </div>
</template>
<script>
import { getRoles } from '@/api/setting'
export default {
  data() {
    return {
      list: [],
      roleIds: []// 保存当前选中的id
    }
  },
  created() {
    this.loadRoles()
  },
  methods: {
    closeDialog() {
      this.$emit('close-dialog')
    },
    async loadRoles() {
      const res = await getRoles({ page: 1, pagesize: 100 })
      this.list = res.data.rows
    }
  }
}
</script>
